Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add AStar2D/AStar3D get_closest_segment with ids #101624

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

RobertBColton
Copy link
Contributor

@RobertBColton RobertBColton commented Jan 16, 2025

Following up on a proposal I made here: godotengine/godot-proposals#11573

I've added a new function get_closest_segment that returns the point ids of the closest segment to a point. This has multiple use cases for a lot of different types of games and gives us more power than the existing function did.

  1. It lets us get the normal of the segment
  2. It lets us use the tangent to splice the segment
  3. It lets us know where to begin path finding within the segment
  4. It allows us to snap nodes along the tangent of the path
  5. It allows us to interpolate to any position within the segment

For anybody interested in further reading about how to represent roads, particularly curved roads within a city builder, I recommend this blog site:
https://www.redblobgames.com/articles/curved-paths/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add AStar2D/AStar3D methods to get the nearest segment point IDs and normal
2 participants